#ifndef TEMPLATE_POINTERSATCK
#define TEMPLATE_POINITERSTCK

template <class Type>
class Stack
{
private:
	enum{SIZE=10};
	int stackSize;
	Type * items;
	int top;

public:
	explicit Stack(int ss = SIZE);
	Stack(const Stack &st);
	~Stack()	{ delete[] items; }
	bool IsEmpty()	{ return top == 0; }
	bool IsFull()	{ return top == stackSize; }
	bool Push(const Type & item);
	bool Pop(Type & item);
	Stack & operator = (const Stack & st);
};

template<class Type>
Stack<Type>::Stack(int ss) : stackSize(ss), top(0)
{
	items = new Type[stackSize];
}

template<class Type>
Stack<Type>::Stack(const Stack & st)
{
	stackSize = st.stackSize;
	top = st.top;
	items = new Type[stackSize];
	for (int i = 0; i < top; i++)
		items[i] = st.items[i];
}

template<class Type>
bool Stack<Type>::Push(const Type & item)
{
	if (top < stackSize)
	{
		items[top++] = item;
		return true;
	}
	else
		return false;
}

template<class Type>
bool Stack<Type>::Pop(Type & item)
{
	if (top > 0)
	{
		item = items[--top];
		return true;
	}
	else
		return false;
}

template<class Type>
Stack<Type> & Stack<Type>::operator = (const Stack<Type> & st)
{
	if (this == st)
		return *this;
	delete [] items;
	stackSize = st.stackSize;
	top = st.top;
	items = new Type[stackSize];
	for (int i = 0; i < top; i++)
		items[i] = st.items[i];
	return *this;
}

#endif